home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 031a / owlbwcc.zip / BWCDELAY.CPP < prev    next >
C/C++ Source or Header  |  1992-02-02  |  4KB  |  100 lines

  1. /**********************************************************************/
  2. /*                  BWCDELAY.cpp by Bob Bourbonnais                   */
  3. /*              released to the public domain 1/28/92                 */
  4. /*          This program shows how to switch to perform               */
  5. /*           delayed processing of check boxes in reply               */
  6. /*            to an OK button using SendDlgItemMessages               */
  7. /*                 to get the status of the buttons.                  */
  8. /**********************************************************************/
  9. #include <owl.h>
  10. #include <dialog.h>
  11. #include "bwcc.h"                        // needed for BWCC
  12. #include "bwcdelay.h"
  13.  
  14. class TMyDialog : public TDialog
  15.   {
  16.   public:
  17.     TMyDialog(LPSTR lpDialogName)          // constructor calls
  18.       : TDialog(NULL,lpDialogName)         // base class constructor
  19.       {
  20.       BWCCGetVersion();    // activate Borland Windows Custom Controls
  21.       }
  22.     virtual void Ok(RTMessage Msg);        // redefines the DDVT function
  23.                        // for the OK button #1
  24.                        // as defined in Base class
  25.                        // TDialog
  26.     virtual void DefChildProc(RTMessage Msg); // default button handler
  27.   };
  28.  
  29. void TMyDialog::Ok(RTMessage Msg)  // Redefines button handler inherited
  30.   {                                // from TDailog for Button #1 IDOK
  31.   char szMyString[180];
  32.  
  33.   if (SendDlgItemMsg(IDB_RADAR12,BM_GETCHECK,0,0))  // check on button
  34.     {                                               // status
  35.     lstrcpy(szMyString,"Radar Unit 12 is Activated.\n");
  36.     }
  37.   else
  38.     {
  39.     lstrcpy(szMyString,"Radar Unit 12 is Shutdown.\n");
  40.     }
  41.  
  42.   if (SendDlgItemMsg(IDB_CONFABULATOR12,BM_GETCHECK,0,0)) // button status
  43.     {
  44.     lstrcat(szMyString,"The Confabulator on Unit 12 is Activated.");
  45.     }
  46.   else
  47.     {
  48.     lstrcat(szMyString,"The Confabulator on Unit 12 is OFF.");
  49.     }
  50.  
  51.   BWCCMessageBox(HWindow,szMyString,"Update on Unit #12",MB_OK); //output
  52.                                  //status
  53.   TDialog::Ok(Msg);     //default OK handler to close dialog box
  54.   }
  55.  
  56. void TMyDialog::DefChildProc(RTMessage Msg)   // default button handler
  57.   {
  58.   if ((Msg.WParam == IDB_RADAR12)|(Msg.WParam == IDB_CONFABULATOR12))
  59.     {          // If either of the unit #12 buttons are pressed then
  60.     TDialog::DefChildProc(Msg);  // pass message along to base class
  61.     }                            // to check the box
  62.   else
  63.     {
  64.     MessageBeep(0);                             // make sound and display
  65.     BWCCMessageBox(HWindow,"Not Implemented",   // a BWCC message box
  66.            "Feature",MB_OK);
  67.     TDialog::DefChildProc(Msg);                 // pass messages along
  68.     }                                           // to base class handler
  69.   }
  70.  
  71. class TDialog1App : public TApplication  // Application Class to contain
  72.   {                                      // the application
  73.   public:
  74.     TDialog1App(LPSTR lpName, HANDLE hInstance,  // constructor calls the
  75.         HANDLE hPrevInstance,            // base class constructor
  76.         LPSTR lpCmdLine, int nCmdShow)
  77.         :TApplication(lpName, hInstance,
  78.                   hPrevInstance,
  79.                   lpCmdLine, nCmdShow) {};
  80.  
  81.     virtual void InitMainWindow(); // overrides base class InitMainWindow
  82.   };
  83.  
  84. void TDialog1App::InitMainWindow() // to initialize a dialog box
  85.   {                                // as the main window
  86.   MainWindow = new TMyDialog("MAINWINDOWDIALOG");
  87.   }
  88.  
  89. int PASCAL WinMain(HANDLE hInstance,              // main entry point from
  90.            HANDLE hPrevInstance,          // windows to this program
  91.            LPSTR lpCmdLine , int nCmdShow)
  92.   {
  93.   TDialog1App Dialog1("Dialog Tester",hInstance,  // create instance of
  94.                hPrevInstance,             // the dialog application
  95.                lpCmdLine,nCmdShow);
  96.   Dialog1.Run();                                  // run it
  97.   return (Dialog1.Status);                        // exit
  98.   }
  99. /**********************************************************************/
  100.